package edu.hawaii.duedates;

import static org.junit.Assert.assertEquals;
import org.junit.Ignore;
import org.junit.Test;


/**
 * JUnit test for DueDates class.  Testing for coverage, so we don't assert anything.
 * 
 * @author Ka Hung Phillip Lau
 * @author Creighton Okada
 */
public class TestDueDates {
  private static final String HSL = "-hsl";
  private static final String BYPASS = "Bypasses PMD";
  private final String barcode = System.getProperty("hsl.barcode");
  private final String pin = System.getProperty("hsl.pin");
  private final String uhId = System.getProperty("uhm.id");
  private final String lastName = System.getProperty("uhm.lastname");
  
  /**
   * Test the checkHawaiiStateLibrary method with an account that has books borrowed.
   * @throws Exception if login is incorrect
   */
  @Ignore
  public void testHslWithBooks() throws Exception {
    String params[] = {HSL, barcode, pin};
    DueDates.main(params);
    assertEquals(BYPASS, 1, 1);
  }
  /**
   * Test the checkHawaiiStateLibrary method with an account that has no books borrowed.
   * @throws Exception if login is incorrect
   */
  @Ignore
  public void testHslNoBooks() throws Exception {
    String params[] = {HSL, "", ""};
    DueDates.main(params);
    assertEquals(BYPASS, 1, 1);
  }
  /**
   * Tests the input of two libraries -uhm, then -hsl.
   * @throws Exception if login is incorrect
   */
  @Ignore
  public void testTwoLibraries1() throws Exception {
    String params[] = {"-uhm", HSL, uhId, lastName, barcode, pin};
    DueDates.main(params);
    assertEquals(BYPASS, 1, 1);
  }
  /**
   * Tests the input of two libraries -hsl, then -uhm.
   * @throws Exception if login is incorrect
   */
  @Ignore
  public void testTwoLibraries2() throws Exception {
    String params[] = {HSL, "-uhm", barcode, pin, uhId, lastName};
    DueDates.main(params);
    assertEquals(BYPASS, 1, 1);
  }
  /**
   * Tests wrong input for library parameter.
   * @throws Exception if an error occurs
   */
  @Test
  public void testIncorrectLibrary() throws Exception {
    String params[] = {"-hls"};
    DueDates.main(params);
    assertEquals(BYPASS, 1, 1);
  }
  /**
   * Tests the exception thrown for invalid credentials.
   * @throws Exception if login is incorrect
   */
  @Test
  public void testException() throws Exception {
    String params[] = {};
    DueDates.main(params);
    assertEquals(BYPASS, 1, 1);
  }
  /**
   * Tests obtaining -within parameter.  NOTE: Emma will not enter the ObtainBooksWithin and 
   * ObtainBooks methods.
   * @throws Exception if there is an error
   */
  @Test
  public void testWithin() throws Exception {
    String params[] = {"-within", "10"};
    String params2[] = {"-within", "a"};
    String params3[] = {"-within"};
    DueDates.main(params3);
    DueDates.main(params2);
    DueDates.main(params);
    assertEquals(BYPASS, 1, 1);
  }
}
